package com.xjl.threadlocal;

/**
 * Created by xiaojinlu1990@163.com on 2019/12/24.
 * 挂载本地线程服务  --》应用场景  用户信息，订单信息等
 */
public class RequestHander {
    private  final static ThreadLocal<Long> requestHander = new ThreadLocal<>();

    public static void add(Long id){
        requestHander.set(id);
    }
    public static void getId(){
        System.out.println(requestHander.get());
    }
    public static void remove(){
        requestHander.remove();
    }

}
